﻿using DependencyAnalysis.DataModel;
using NUnit.Framework;

namespace NUnitExample
{
    [TestFixture]
    public class ModuleQualityTest : DependencyTest
    {
        [Test]
        public void NoModuleIsInZoneOfUselessness()
        {
            Verifier.VerifyThat<ModuleDescriptor>((x, state) =>
            {
                if (!x.IsPartOfProject) return true;
                var d = Setup.Metrics.DistanceFromMainSequence(x);
                if (d > 0.7)
                {
                    state.Message = string.Format("{0:0.00}", d);
                    return false;
                }
                return true;
            });
        }

        [Test]
        public void NoModuleIsInZoneOfPain()
        {
            Verifier.VerifyThat<ModuleDescriptor>((x, state) =>
            {
                if (!x.IsPartOfProject) return true;
                var d = Setup.Metrics.DistanceFromMainSequence(x);
                if (d < -0.7)
                {
                    state.Message = string.Format("{0:0.00}", d);
                    return false;
                }
                return true;
            });
        }

    }
}
